<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>级联列表页面</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="js/ajax.js"></script>
    <script type="text/javascript">
    	function refresh() {
    		var prov = document.getElementsByName("prov")[0];
    		var p = prov.value;
    		var city = document.getElementsByName("city")[0];
    		if(p == "") {
    			city.length = 0;
    			city.options.add(new Option("--请选择城市--"));
    		} else {
    			var url = "list";
    			var params = "proc=" + p;
    			sendRequest(url, params, 'POST', show);
    		}
    	}
    	
    	function show() {
    		if(xmlHttpRequest.readyState == 4) {
    			if(xmlHttpRequest.status == 200) {
    				var citylist = xmlHttpRequest.responseText.split(",");
    				var citynum = citylist.length;
    				var city = document.getElementsByName("city")[0];
    				city.length = 0;
    				for(i = 0; i < citynum; i++) {
    					city.options.add(new Option(citylist[i]));
    				}
    			}
    		}
    	}
    </script>
  </head>
  
  <body>
  	<form action="">
  		<select name="prov" onchange="refresh()">
  			<option value="">--请选择省份--</option>
  			<option value="山东">山东</option>
  			<option value="江苏">江苏</option>
  			<option value="广东">广东</option>
  		</select>
  		<select name="city">
  			<option>--请选择城市--</option>
  		</select>
  	</form>
  </body>
</html>
